package com.sjyl.kaoshitong.fragment;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sjyl.kaoshitong.R;
import com.sjyl.kaoshitong.adapter.SlidingFragmentAdapter;
import com.sjyl.kaoshitong.util.Utility;

/**
 * Created by ChangerLow on 15/4/2.
 * Email: changerlow@qq.com
 */
public class DocumentMainFragment extends Fragment {
    private static final String TAG = "DocumentMainFragment";
    private TabLayout tabLayout;
    private ViewPager pager;
    private String [] titles = null;

    public static DocumentMainFragment newInstance(String param) {
        DocumentMainFragment fragment = new DocumentMainFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    public DocumentMainFragment() {
        // Required empty public constructor
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {

        }
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_base_slidingtab_layout, container, false);
        pager = (ViewPager)rootView.findViewById(R.id.pager);
        titles = getActivity().getResources().getStringArray(R.array.tabs_document_titles);
        SlidingFragmentAdapter adapter = new SlidingFragmentAdapter(getChildFragmentManager(), titles, Utility.TAB_TYPE.DOCUMENT);
        pager.setAdapter(adapter);
        tabLayout = (TabLayout)rootView.findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(pager);

        return rootView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }


}
